package main

func GetSuggestions(rate float64, val int, age int) (suggestions string) {
	if val == 1 {
		suggestions = getMaleSuggestion(rate, age)
	} else {
		suggestions = getFeMaleSuggestion(rate, age)
	}
	return
}

//男生输出的建议
func getMaleSuggestion(floatBodyFat float64, intAge int) (suggestions string) {
	suggestions = ""
	switch {
	case intAge >= 18 && intAge <= 39:
		switch {
		case floatBodyFat > 0.0 && floatBodyFat <= 0.10:
			suggestions = "你的体型属于偏瘦"
		case floatBodyFat > 0.1 && floatBodyFat <= 0.16:
			suggestions = "你的体型属于正常"
		case floatBodyFat > 0.16 && floatBodyFat <= 0.21:
			suggestions = "你的体型属于偏重"
		case floatBodyFat > 0.21 && floatBodyFat <= 0.26:
			suggestions = "你的体型属于肥胖"
		case floatBodyFat > 0.26:
			suggestions = "你的体型属于严重肥胖"
		default:
			suggestions = "你的体脂率小于0，请核对输入的信息"
		}
	case intAge >= 40 && intAge <= 59:
		switch {
		case floatBodyFat > 0 && floatBodyFat <= 0.11:
			suggestions = "你的体型属于偏瘦"
		case floatBodyFat > 0.11 && floatBodyFat <= 0.17:
			suggestions = "你的体型属于正常"
		case floatBodyFat > 0.17 && floatBodyFat <= 0.22:
			suggestions = "你的体型属于偏重"
		case floatBodyFat > 0.22 && floatBodyFat <= 0.27:
			suggestions = "你的体型属于肥胖"
		case floatBodyFat > 0.27:
			suggestions = "你的体型属于严重肥胖"
		default:
			suggestions = "你的体脂率小于0，请核对输入的信息"
		}
	case intAge >= 60:
		switch {
		case floatBodyFat > 0 && floatBodyFat <= 0.13:
			suggestions = "你的体型属于偏瘦"
		case floatBodyFat > 0.13 && floatBodyFat <= 0.19:
			suggestions = "你的体型属于正常"
		case floatBodyFat > 0.19 && floatBodyFat <= 0.24:
			suggestions = "你的体型属于偏重"
		case floatBodyFat > 0.24 && floatBodyFat <= 0.29:
			suggestions = "你的体型属于肥胖"
		case floatBodyFat > 0.29:
			suggestions = "你的体型属于严重肥胖"
		default:
			suggestions = "你的体脂率小于0，请核对输入的信息"
		}
	default:
		suggestions = "输入的年龄异常，请核对输入的信息"
	}
	return
}

//女生输出的建议
func getFeMaleSuggestion(floatBodyFat float64, intAge int) (suggestions string) {
	suggestions = ""
	switch {
	case intAge >= 18 && intAge <= 39:
		switch {
		case floatBodyFat > 0 && floatBodyFat <= 0.2:
			suggestions = "你的体型属于偏瘦"
		case floatBodyFat > 0.2 && floatBodyFat <= 0.27:
			suggestions = "你的体型属于正常"
		case floatBodyFat > 0.27 && floatBodyFat <= 0.34:
			suggestions = "你的体型属于偏重"
		case floatBodyFat > 0.34 && floatBodyFat <= 0.39:
			suggestions = "你的体型属于肥胖"
		case floatBodyFat > 0.39:
			suggestions = "你的体型属于严重肥胖"
		default:
			suggestions = "你的体脂率小于0，请核对输入的信息"
		}
	case intAge >= 40 && intAge <= 59:
		switch {
		case floatBodyFat > 0 && floatBodyFat <= 0.21:
			suggestions = "你的体型属于偏瘦"
		case floatBodyFat > 0.21 && floatBodyFat <= 0.28:
			suggestions = "你的体型属于正常"
		case floatBodyFat > 0.28 && floatBodyFat <= 0.35:
			suggestions = "你的体型属于偏重"
		case floatBodyFat > 0.35 && floatBodyFat <= 0.40:
			suggestions = "你的体型属于肥胖"
		case floatBodyFat > 0.40:
			suggestions = "你的体型属于严重肥胖"
		default:
			suggestions = "你的体脂率小于0，请核对输入的信息"
		}
	case intAge >= 60:
		switch {
		case floatBodyFat > 0 && floatBodyFat <= 0.22:
			suggestions = "你的体型属于偏瘦"
		case floatBodyFat > 0.22 && floatBodyFat <= 0.2:
			suggestions = "你的体型属于正常"
		case floatBodyFat > 0.29 && floatBodyFat <= 0.36:
			suggestions = "你的体型属于偏重"
		case floatBodyFat > 0.36 && floatBodyFat <= 0.41:
			suggestions = "你的体型属于肥胖"
		case floatBodyFat > 0.41:
			suggestions = "你的体型属于严重肥胖"
		default:
			suggestions = "你的体脂率小于0，请核对输入的信息"
		}
	default:
		suggestions = "输入的年龄异常，请核对输入的信息"
	}
	return
}
